﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/InternalPage.Master" Inherits="MvcContrib.FluentHtml.ModelViewPage<ChangePasswordViewModel>" %>

<asp:Content ID="changePasswordTitle" ContentPlaceHolderID="TitleContent" runat="server">
  Change Password
</asp:Content>
<asp:Content ID="changePasswordHeader" ContentPlaceHolderID="PageHeader" runat="server">
  Change Password</asp:Content>
<asp:Content ID="changePasswordContent" ContentPlaceHolderID="MainContent" runat="server">
  <p>
    Use the form below to change your password.
  </p>
  <p>
    New passwords are required to be a minimum of
    <%=Html.Encode(ViewData["PasswordLength"])%>
    characters in length.
  </p>
  <div class="account-form">
    <% using ( Html.BeginForm("ChangePassword", "Account", FormMethod.Post, new { id = "changePasswordForm" }) )
       { %>
    <div class="center">
      <h2>Account Information</h2></div>
    <div class="clearDiv entry-row">
      <%= this.Label(m => m.CurrentPassword).Value("Current Password:") %>
      <%= this.Password(m => m.CurrentPassword).Class("text").ValidateForRequired()%>
    </div>
    <div class="clearDiv entry-row">
      <%= this.Label(m => m.NewPassword).Value("New Password:") %>
      <%= this.Password(m => m.NewPassword).Class("text").ValidateForRequired()%>
    </div>
    <div class="clearDiv entry-row">
      <%= this.Label(m => m.RepeatPassword).Value("Confirm New Password:") %>
      <%= this.Password(m => m.RepeatPassword).Class("text").ValidateForRequired()%>
    </div>
    <div class="center">
      <a href="#" onclick="$('#changePasswordForm').trigger('submit');" class="btn">Change
        Password</a>
    </div>
    <% } %>
  </div>
</asp:Content>
<asp:Content ID="changePasswordScripts" ContentPlaceHolderID="Scripts" runat="server">
  <script type="text/javascript">
    $(document).ready(function () {
      $('#changePasswordForm').validate({
        // need to explicitly set this option - other rules are set by html meta-data
        rules: { PasswordConfirmation: { equalTo: "#changePasswordForm #NewPassword"} }
      }); // jquery validation 
    });
  </script>
</asp:Content>
